﻿<%@ Page Language="C#" StylesheetTheme="Skin1" MasterPageFile="~/LTR/MlyLtrMaster.Master" AutoEventWireup="true" CodeBehind="Clients.aspx.cs"
  Inherits="MLY.LTR.Client" Title='<%$Dict:Clients.Title %>' %>

<asp:Content ID="title" ContentPlaceHolderID="titleHolder" runat="server">
  <title>
    <asp:Literal ID="Literal21" Text='<%$Dict:Titles.Clients%>' runat="server"></asp:Literal>
  </title>
  <script language="javascript" type="text/javascript">

      window.onload = function() {
          $("#my_suppliersmenuitem").addClass('active');
      }
    </script>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
  <asp:Label ID="lblSuccessDelete" runat="server" Text="<%$Dict:Clients.lblSuccessDelete %>" ForeColor="Green" Font-Bold="True"
    Font-Size="16pt"></asp:Label><br />
  <asp:Label ID="lblErrDelete" runat="server" Text="<%$Dict:Clients.lblErrDelete %>" ForeColor="Red" Font-Bold="True" Font-Size="16pt"></asp:Label>
  <asp:GridView ID="GridView1" SkinID="GridViewSkin" runat="server" AutoGenerateColumns="False" DataSourceID="ObjectDataSource1"
    AllowSorting="false" OnSorting="GridView1_Sorting1" OnPreRender="GridView1_PreRender">
    <Columns>
      <asp:TemplateField HeaderStyle-Width="63">
        <HeaderTemplate>
          <asp:Label ID="Label2" runat="server" Text="<%$Dict:Clients.AddRel%>"></asp:Label>
          <asp:ImageButton ID="ImageButton1" runat="server" PostBackUrl="<%#&quot;ClientsCard.aspx?ClientId=-1&quot;%>" ImageUrl="~/Images/add_line_icon.png" />
        </HeaderTemplate>
        <ItemTemplate>
          <table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td style="width: 41px">
                <asp:ImageButton ID="btnDelete" runat="server" CommandArgument='<%# Eval("OrganizationId") %>' ImageUrl="~/Images/massage/delete_icon.png"
                  OnClick="btnDelete_OnClick" />
              </td>
              <td>
                <img src="/Images/massage/line_division_between-icons.png" />
              </td>
              <td style="width: 40px;">
                <asp:ImageButton runat="server" ID="HyperLinkEdit" PostBackUrl="<%#String.Format(&quot;ClientsCard.aspx?ClientId={0}&quot;,Eval(&quot;OrganizationId&quot;))%>"
                  ImageUrl="~/Images/massage/magnify_massage_icon.png" />
              </td>
            </tr>
          </table>
          <ajaxToolKit:ConfirmButtonExtender TargetControlID="btnDelete" runat="server" ConfirmText=" are you sure you want to delete this message? ">
          </ajaxToolKit:ConfirmButtonExtender>
        </ItemTemplate>
      </asp:TemplateField>
      <asp:BoundField HeaderStyle-Width="106" DataField="OrganizationName" HeaderText="<%$Dict:Clients.OrganizationName%>" SortExpression="OrganizationName" />
      <asp:BoundField DataField="ContactPerson" HeaderStyle-Width="118" HeaderText="<%$Dict:Clients.ContactPerson%>" SortExpression="ContactPerson" />
      <asp:TemplateField HeaderText="<%$Dict:Clients.ContactPersonEmail%>" HeaderStyle-Width="123" SortExpression="ContactPersonEmail">
        <ItemTemplate>
          <a href="mailto:<%# Eval("OrganizationEmail") %>">
            <%# Eval("OrganizationEmail") %></a>
        </ItemTemplate>
      </asp:TemplateField>
      <asp:TemplateField HeaderText="<%$Dict:Clients.WebSite%>" HeaderStyle-Width="134" SortExpression="WebSite">
        <ItemTemplate>
          <a style="color: Blue;" href="http://<%# Eval("WebSite") %>">
            <%# Eval("WebSite")%></a>
        </ItemTemplate>
      </asp:TemplateField>
      <asp:TemplateField SortExpression="countMe" HeaderStyle-Width="100">
        <HeaderTemplate>
          <asp:HyperLink Text="<%$Dict:Clients.OpenedOrders%>" runat="server" ID="openedOrdersHeader" ForeColor="White"></asp:HyperLink>
        </HeaderTemplate>

        <ItemTemplate>
          <asp:HyperLink Text='<%# Bind("countMe") %>' ID="HyperLinkWOCount" runat="server" 
                         NavigateUrl="<%#String.Format(&quot;../LTR/Inventory.aspx?ClientID={0}&quot;,Eval(&quot;OrganizationId&quot;))%>">
          </asp:HyperLink>
          
        </ItemTemplate>
      </asp:TemplateField>
      <asp:BoundField DataField="totalSum" HeaderStyle-Width="60" 
                      HeaderText="<%$Dict:Clients.totalSum%>" SortExpression="totalSum" Visible="True"  />
    </Columns>
  </asp:GridView>
  <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetOrganizationShortByContractorId"
    TypeName="MLY.Bll.OrganizationShort">
    <SelectParameters>
      <asp:SessionParameter DefaultValue="-1" Name="contractorId" SessionField="OrganizationId" Type="Int32" />
      <asp:Parameter Direction="input" Type="string" Name="p_sortExpression"></asp:Parameter>
      <asp:Parameter Direction="input" Type="string" Name="p_sortDirection"></asp:Parameter>
    </SelectParameters>
  </asp:ObjectDataSource>
  <div id="divEmptyGrid" visible="False" runat="server">
    <asp:Label ID="lblNoMessages" Text='<%$Dict:Clients.lblNoMessages %>' runat="server"></asp:Label>
    <asp:ImageButton ID="imgAddNewOnNoRows" ImageUrl="~/Images/imgbtnAdd.png" runat="server" OnClick="imgAddNewOnNoRows_Click" />
  </div>
</asp:Content>
